let eventList = [
  {
    tagName: '会员事件',
    id: 'member',
    type: 1
  },
  {
    tagName: '消费事件',
    id: 'consumption',
    type: 2
  },
]

//升级降级级数
let levelList = [
  {
    tagName: '1级',
    id: 1
  },
  {
    tagName: '2级',
    id: 2
  },
  {
    tagName: '3级',
    id: 3
  },
  {
    tagName: '4级',
    id: 4
  },
  {
    tagName: '5级',
    id: 5
  }
]

// 优惠券（红包）活动状态下拉框数据
activeStatus = [
  {
    tagName: '进行中',
    id: 'doing'
  },
  {
    tagName: '待开始',
    id: 'waiting'
  },
]

// 核销渠道数据
let channelStatus = [
  {
    tagName: 'app',
    id: 'app'
  },
  {
    tagName: '线下门店',
    id: 'shop'
  },
  {
    tagName: '小程序',
    id: 'mini'
  },
  {
    tagName: 'web',
    id: 'web'
  },
]


let memberEventList = [
  {
    tagName: '升级事件',
    id: 'member_upgrade'
  },
  {
    tagName: '降级事件',
    id: 'member_downgrade'
  },
]
let cosumeEventList = [
  {
    tagName: '优惠券核销',
    id: 'coupons_verification'
  },
  {
    tagName: '红包核销',
    id: 'redEnvelope_verification'
  },
  {
    tagName: '积分兑换',
    id: 'points_exchange'
  },
  {
    tagName: '积分抵现',
    id: 'points_cash_in'
  },
]

let pointsExchangeContents = [
  {
    tagName: '兑换优惠券',
    code: 'points_exchange_coupon'
  },
  {
    tagName: '兑换红包',
    code: 'points_exchange_redEnvelope'
  },
]

function getEventCodeListByType (type) {
  let list = null;
  switch(type) {
    case 1:
      list = memberEventList;
      break;
    case 2:
      list = cosumeEventList;
      break;
  }
  return list;
}


// 不同类型事件需要保存的属性值
let eventJsonProperties = {
  "member_upgrade": ['eventName', 'eventRangeTime', 'memberNum'],
  "member_downgrade": ['eventName', 'eventRangeTime', 'memberNum'],
  "coupons_verification": ['eventName', 'eventRangeTime', 'promCode', 'verificationChannels'],
  "redEnvelope_verification": ['eventName', 'eventRangeTime', 'promCode', 'verificationChannels'],
  "points_exchange": ['eventName', 'eventRangeTime', 'pointsExchangeContent', 'pointsExchangeNum'],
  "points_cash_in": ['eventName', 'eventRangeTime', 'pointsCashInAmount', 'pointsCashInNum'],
}

function checkRemoveJsonProperties (code, key) {
  return eventJsonProperties[code].indexOf(key) != -1;
}


module.exports = {
  eventList,
  levelList,
  activeStatus,
  channelStatus,
  pointsExchangeContents,

  getEventCodeListByType,
  checkRemoveJsonProperties,
}
